/*    */ package com.wzh.utils;
/*    */ 
/*    */ import java.lang.reflect.ParameterizedType;
/*    */ import java.lang.reflect.Type;
/*    */ 
/*    */ public class GenericsUtils
/*    */ {
/*    */   public static Class getSuperClassGenericType(Class clazz, int index)
/*    */   {
/* 21 */     Type genType = clazz.getGenericSuperclass();
/*    */ 
/* 23 */     if (!(genType instanceof ParameterizedType)) {
/* 24 */       return Object.class;
/*    */     }
/*    */ 
/* 27 */     Type[] params = ((ParameterizedType)genType).getActualTypeArguments();
/* 28 */     if ((index >= params.length) || (index < 0)) {
/* 29 */       throw new RuntimeException("你输入的索引" + (index < 0 ? "不能小于0" : "超出了参数的总数"));
/*    */     }
/* 31 */     if (!(params[index] instanceof Class)) {
/* 32 */       return Object.class;
/*    */     }
/* 34 */     return (Class)params[index];
/*    */   }
/*    */ 
/*    */   public static Class getSuperClassGenericType(Class clazz)
/*    */   {
/* 45 */     return getSuperClassGenericType(clazz, 0);
/*    */   }
/*    */ }

/* Location:           C:\work\apache-tomcat-7.0.55\webapps\ROOT\WEB-INF\classes\
 * Qualified Name:     com.wzh.utils.GenericsUtils
 * JD-Core Version:    0.6.1
 */